package com.atguigu.gmall.cart.client;

import com.atguigu.gmall.cart.client.impl.CartDegradeFeignClient;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * <p>
 * 购物车API接口
 * </p>
 *
 */
@FeignClient(value = "service-cart", fallback = CartDegradeFeignClient.class)
public interface CartFeignClient {

    // 不需要HttpServletRequest request   因为在feign 传递的时候，拦截器处理了
    @PostMapping("api/cart/addToCart/{skuId}/{skuNum}")
    public Result addToCart(@PathVariable("skuId") Long skuId,
                            @PathVariable("skuNum")Integer skuNum);

    //根据用户Id 查询用户的收货地址列表！
    @GetMapping("api/cart/getCartCheckedList/{userId}")
    public List<CartInfo> getCartCheckedList(@PathVariable("userId") String userId);

    //根据userId 查询购物车最新价格
    @GetMapping("/api/cart/loadCartCache/{userId}")
    void loadCartCache(@PathVariable("userId") String userId);
}
